/*
 * Copyright (c) 2021, 2022, yzfh.cn All rights reserved.
 *
 */
package com.ly.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yzfh
 * @Date 2022/03/07 星期一 20:31:30
 */
//Rest模式
@RestController
@RequestMapping("/books")
public class BookController {

    @Value("${country}")
    private String country;

    @Value("${users.name}")
    private String name1;

    @Autowired
    private Environment env;

    @Value("${tempDir}")
    private String tempDir;

    @Value("${tempDir2}")
    private String tempDir2;

    @GetMapping
    public String getById(){
        System.out.println("springboot is running ...");
        System.out.println("country ===> "+country);
        System.out.println("name ===> "+name1);
        System.out.println("users2[0].name ===> "+env.getProperty("users2[0].name"));
        System.out.println("users3[0].name ===> "+env.getProperty("users3[0].name"));
        System.out.println("like[1] ===> "+env.getProperty("like[1]"));
        System.out.println("like2[1] ===> "+env.getProperty("like2[1]"));
        System.out.println("tempDir ===> "+tempDir);
        System.out.println("tempDir2 ===> "+tempDir2);
        return "springboot is running...";
    }

}
